﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace YXShop.Web.membercenter.individualinfo
{
    public partial class usefullist : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int uid = ChangeHope.WebPage.PageRequest.GetQueryInt("uid");
                this.litData.Text = GetList(uid, 2);
            }
        }

        #region 点卷日期
        /// <summary>
        /// Table绑定 点卷与日期
        /// </summary>
        /// <param name="id">用户ID</param>
        /// <param name="type">操作明细类型</param>
        /// <returns></returns>
        public string GetList(int id, int type)
        {
            ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table();
            YXShop.BLL.Member.UserInfoNote noteBll = new YXShop.BLL.Member.UserInfoNote();
            ChangeHope.DataBase.DataByPage dataPage = noteBll.GetListByIdAndType(id, type);
        
            table.AddHeadCol("", "时间");
            table.AddHeadCol("", "添加日期");
            table.AddHeadCol("", "减少日期");
            table.AddHeadCol("", "操作人员");
            table.AddHeadCol("", "备注/原因");
            table.AddRow();                     
            if (dataPage.DataReader != null)
            {
                while (dataPage.DataReader.Read())
                {
                    table.AddCol(dataPage.DataReader["noteDate"].ToString());
                    table.AddCol(dataPage.DataReader["buckleOrAdd"].ToString() == "0" ? dataPage.DataReader["ticketCount"].ToString()+"天" : "");
                    table.AddCol(dataPage.DataReader["buckleOrAdd"].ToString() == "1" ? dataPage.DataReader["ticketCount"].ToString()+"天" : "");
                    table.AddCol(dataPage.DataReader["noteName"].ToString());
                    table.AddCol(dataPage.DataReader["causation"].ToString());
                    table.AddRow();
                }
                string view = table.GetTable() + dataPage.PageToolBar;
                dataPage.Dispose();
                dataPage = null;
                return view;
            }
            else
            {
                return "没有找到相关的信息";
            }

        }
        #endregion
    }
}
